package org.chnxi.study.serialize.gson;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import lombok.Data;

import java.util.List;

@Data
public class Student {

    private String name;


    private List<Teacher> teachers;

    private List<Book> books;

    @Override
    public String toString() {
        GsonBuilder builder = new GsonBuilder();
        builder.registerTypeAdapter(Teacher.class, new TeacherAdapterForGson());
        Gson mygson = builder.create();
        return mygson.toJson(this);
    }
}
